﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sparrow.Reflection
{
    public class MetadataCollection<T>:IEnumerable<T>
    {
        public MetadataCollection()
        {
            this.Items = new Dictionary<string, T>();
        }

        public Dictionary<string,T> Items
        {
            get;set;
        }
        public virtual T this[string name]
        {
            get
            {
                try
                {
                    return this.Items[name];
                }
                catch
                {
                    return default(T);
                }
            }
            set
            {
                //
            }
        }

        #region IEnumerable<T> Members

        public IEnumerator<T> GetEnumerator()
        {
            return this.Items.Values.GetEnumerator();
        }

        #endregion

        #region IEnumerable Members

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return this.Items.Values.GetEnumerator();
        }

        #endregion
    }
}
